public class Diamond {
    public static void main(String[] args) {
        int rows = 5;
        printDiamond(rows);
    }
    
    private static void printDiamond(int n){
        // 上半部分包括中间一行
        for (int i=0; i<n; i++){
            for (int j=i; j<n-1; j++)
                System.out.print(" ");
                
            for (int k=0; k<=i*2; k++)
                System.out.print("*");
            
            System.out.println();
        }

        // 下半部分不包括中间一行 
        for (int i=n-2; i>=0; i--){
            for (int j=0; j<n-i-1; j++)
                System.out.print(" ");

            for (int k=0; k<i * 2 + 1; k++)  
                System.out.print("*");

            System.out.println();         
        }       
   }
}